package model;

import java.util.ArrayList;
import java.util.List;

import common.DataManager;
import common.GridCoordinate;

/**
 * @author Colin
 * 
 * The SmallWeapon is a manual weapon that damages to a
 * square range of grids that the user chooses.
 *
 */
public class SmallCanon extends ManualWeapon{

	private static final int INITIAL_DAMAGE = 2;
	private static final int COST = 20;
	private static final int INITIAL_RANGE_INT = 0;
	private static final int INITIAL_SPEED = 15;
	
	//SmallCanon without position
	public SmallCanon(){
		super("Small Canon", DataManager.SMALL_CANON, DataManager.SMALL_CANON_AMMO, COST, INITIAL_DAMAGE, INITIAL_SPEED, INITIAL_RANGE_INT);
		
	}
	
	//SmallCanon with position
	public SmallCanon(GridCoordinate position){
		super("Small Canon", DataManager.SMALL_CANON, DataManager.SMALL_CANON_AMMO, COST, position, INITIAL_DAMAGE, INITIAL_SPEED, INITIAL_RANGE_INT);
		
	}
	

	@Override
	public void createRange() {
		List<GridCoordinate> r = new ArrayList<GridCoordinate>();
		if(getRangeInt() == 0){
			r.add(getPosition());
		}
		else{
			for( int i = -1*this.getRangeInt(); i <= this.getRangeInt(); ++i ){
				for( int j = -1*this.getRangeInt(); j <= this.getRangeInt(); ++j ){
					r.add( new GridCoordinate( getPosition().getX() + i, getPosition().getY() + j));
				}
			}
		}
		setRange(r);
		
	}

	@Override
	public String getDescription() {
		return "The Small Canon deals 3 damage to all zombosaurs that it directly hits.";
	}

	
}
